from tkinter.ttk import Style

from docx.shared import Inches, RGBColor, Pt
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT


def style(paragraph=None, alignment=WD_PARAGRAPH_ALIGNMENT.LEFT,space_after=0.5,space_before=1,
          line_spacing=1.5, font_bold: bool = False, font_color: RGBColor = RGBColor(0, 0, 0),
           first_line_indent=Inches(36 / 72), font_name='宋体', font_size=10):
    def decorator(cls):
        if paragraph is None:
            cls.__annotations__ = Style(alignment,first_line_indent, font_name,
                                        font_size,space_after,space_before,line_spacing,
                                        font_bold,font_color)
        else:
            cls.__annotations__ = paragraph
        return cls

    return decorator


class Style:
    def __init__(self, alignment,first_line_indent, font_name,
                 font_size,space_after=0.5,space_before=1.5,line_spacing=1.5, font_bold: bool = False, font_color: RGBColor = RGBColor(0, 0, 0)):
        """
        段落的对齐方式
        """
        self.alignment = alignment
        """
        行间距
        """
        self.line_spacing: float = line_spacing
        """
        首行缩进
        """
        self.first_line_indent: float = first_line_indent
        self.space_after=Pt(space_after)
        """与后面间距"""
        self.space_before=Pt(space_before)
        """与前面间距"""

        """
        下面的不建议使用，字体在Font中
        """
        """
        字体
        """
        self.font_name: str = font_name
        """
        大小
        """
        self.font_size: Pt = Pt(font_size)
        """
        是否加粗
        """
        self.font_bold: bool = font_bold
        """
        字体颜色
        """
        self.font_color: RGBColor = font_color
